~ chicken-core (chicken-5) /manual/Module (chicken bitwise)
Trap1[[tags: manual]]2[[toc:]]34== Module (chicken bitwise)56Binary integer operations are provided by the {{(chicken bitwise)}}7module.89=== Binary integer operations1011<procedure>(bitwise-and N1 ...)</procedure>12<procedure>(bitwise-ior N1 ...)</procedure>13<procedure>(bitwise-xor N1 ...)</procedure>14<procedure>(bitwise-not N)</procedure>15<procedure>(arithmetic-shift N1 N2)</procedure>1617Binary integer operations. {{arithmetic-shift}} shifts the argument {{N1}} by18{{N2}} bits to the left. If {{N2}} is negative, then {{N1}} is shifted to the19right. These operations only accept exact integers.2021==== bit->boolean2223<procedure>(bit->boolean N INDEX)</procedure>2425Returns {{#t}} if the bit at the position {{INDEX}} in the integer26{{N}} is set, or {{#f}} otherwise. The rightmost/least-significant bit27is bit 0.2829==== integer-length3031<procedure>(integer-length N)</procedure>3233Returns the number of bits needed to represent the exact integer N in342's complement notation.3536---37Previous: [[Module (chicken base)]]3839Next: [[Module (chicken blob)]]